1121A - Technogoblet of Fire - CodeForces Solution


implementation sortings *1100

Please click on ads to support us..

C++ Code:

/*
ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम् ।
उर्वारुकमिव बन्धनान् मृत्योर्मुक्षीय मामृतात् ॥ */

#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    int n, m, k;
    cin >> n >> m >> k;
    int power[n], school[n];
    int select[k];
    unordered_map<int, int> um;
    for (int i = 0; i < n; i++)
    {
        cin >> power[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> school[i];
        if (um[school[i]] < power[i])
        {
            um[school[i]] = power[i];
        }
    }
    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        cin >> select[i];
        if (power[select[i] - 1] != um[school[select[i] - 1]])
        {
            ans++;
        }
    }
    cout << ans;

    return 0;
}


Comments

Submit
0 Comments
More Questions

215B - Olympic Medal
1445A - Array Rearrangment
1351A - A+B (Trial Problem)
935B - Fafa and the Gates
1291A - Even But Not Even
1269A - Equation
441A - Valera and Antique Items
1702C - Train and Queries
816B - Karen and Coffee
838D - Airplane Arrangements
148B - Escape
847G - University Classes
1110A - Parity
1215B - The Number of Products
604C - Alternative Thinking
1204C - Anna Svyatoslav and Maps
322A - Ciel and Dancing
1689B - Mystic Permutation
1711B - Party
1702D - Not a Cheap String
1714F - Build a Tree and That Is It
1703F - Yet Another Problem About Pairs Satisfying an Inequality
610A - Pasha and Stick
1200A - Hotelier
1091A - New Year and the Christmas Ornament
1352B - Same Parity Summands
1102A - Integer Sequence Dividing
630B - Moore's Law
1004A - Sonya and Hotels
1680B - Robots